/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.gatech.oad.antlab.person;

public class Person4 {
  /** Holds the persons real name */
  private String name;
    /**
     * The constructor, takes in the persons
     * name
     * @param pname the person's real name
     */
  public Person4(String pname) {
    name = pname;
  }
    /**
     * This method should take the string
     * input and return its characters rotated
     * 2 positions.
     * given "gtg123b" it should return
     * "g123bgt".
     *
     * @param input the string to be modified
     * @return the modified string
     */
    private String calc(String input) {
      String result = new String();
      char[] temp = new char[input.length()];
      for (int i=2;i<input.length();i++)
	{
		temp[i-2]=input.charAt(i);
	}
	temp[input.length()-2]=input.charAt(0);
	temp[input.length()-1]=input.charAt(1);
      for (int i=0;i<input.length();i++)
      {
        result+=temp[i];
      }
      return result;
    }

    /**
     * Return a string rep of this object
     * that varies with an input string
     *
     * @param input the varying string
     * @return the string representing the
     *         object
     */
    public String toString(String input) {
      return name + calc(input);
    }

}



